$OpenBSD: patch-kdecore_util_kshareddatacache_p_h,v 1.2 2017/04/12 17:59:32 landry Exp $
--- kdecore/util/kshareddatacache_p.h.orig	Fri Jun 26 05:14:18 2015
+++ kdecore/util/kshareddatacache_p.h	Mon Apr 10 08:11:14 2017
@@ -106,9 +106,8 @@ class KSDCLock { (public)
 
     // Return value indicates if the mutex was properly initialized (including
     // threads-only as a fallback).
-    virtual bool initialize(bool &processSharingSupported)
+    virtual bool initialize()
     {
-        processSharingSupported = false;
         return false;
     }
 
@@ -135,11 +134,10 @@ class simpleSpinLock : public KSDCLock (public)
     {
     }
 
-    virtual bool initialize(bool &processSharingSupported)
+    virtual bool initialize()
     {
         // Clear the spinlock
         m_spinlock = 0;
-        processSharingSupported = true;
         return true;
     }
 
@@ -194,29 +192,21 @@ class pthreadLock : public KSDCLock (public)
     {
     }
 
-    virtual bool initialize(bool &processSharingSupported)
+    virtual bool initialize()
     {
         // Setup process-sharing.
         pthread_mutexattr_t mutexAttr;
-        processSharingSupported = false;
 
         // Initialize attributes, enable process-shared primitives, and setup
         // the mutex.
         if (::sysconf(_SC_THREAD_PROCESS_SHARED) >= 200112L && pthread_mutexattr_init(&mutexAttr) == 0) {
             if (pthread_mutexattr_setpshared(&mutexAttr, PTHREAD_PROCESS_SHARED) == 0 &&
                 pthread_mutex_init(&m_mutex, &mutexAttr) == 0)
-            {
-                processSharingSupported = true;
-            }
             pthread_mutexattr_destroy(&mutexAttr);
+            return true;
         }
 
-        // Attempt to setup for thread-only synchronization.
-        if (!processSharingSupported && pthread_mutex_init(&m_mutex, NULL) != 0) {
-            return false;
-        }
-
-        return true;
+        return false;
     }
 
     virtual bool lock()
@@ -267,23 +257,18 @@ class semaphoreLock : public KSDCLock (public)
     {
     }
 
-    virtual bool initialize(bool &processSharingSupported)
+    virtual bool initialize()
     {
-        processSharingSupported = false;
         if (::sysconf(_SC_SEMAPHORES) < 200112L) {
             return false;
         }
 
         // sem_init sets up process-sharing for us.
         if (sem_init(&m_semaphore, 1, 1) == 0) {
-            processSharingSupported = true;
+            return true;
         }
-        // If not successful try falling back to thread-shared.
-        else if (sem_init(&m_semaphore, 0, 1) != 0) {
-            return false;
-        }
 
-        return true;
+        return false;
     }
 
     virtual bool lock()
@@ -367,9 +352,10 @@ struct SharedLock
  */
 static SharedLockId findBestSharedLock()
 {
+#if 0
     // We would prefer a process-shared capability that also supports
     // timeouts. Failing that, process-shared is preferred over timeout
-    // support. Failing that we'll go thread-local
+    // support. Failing that we'll go with spinning lock.
     bool timeoutsSupported = false;
     bool pthreadsProcessShared = false;
     bool semaphoresProcessShared = false;
@@ -393,7 +379,7 @@ static SharedLockId findBestSharedLock()
             tempLock = QSharedPointer<KSDCLock>(new pthreadLock(tempMutex));
         }
 
-        tempLock->initialize(pthreadsProcessShared);
+        pthreadsProcessShared = tempLock->initialize();
     }
 #endif
 
@@ -413,7 +399,7 @@ static SharedLockId findBestSharedLock()
             tempLock = QSharedPointer<KSDCLock>(new semaphoreLock(tempSemaphore));
         }
 
-        tempLock->initialize(semaphoresProcessShared);
+        semaphoresProcessShared = tempLock->initialize();
     }
 #endif
 
@@ -426,6 +412,7 @@ static SharedLockId findBestSharedLock()
     else if(semaphoresProcessShared) {
         return LOCKTYPE_SEMAPHORE;
     }
+#endif    // 0
 
     // Fallback to a dumb-simple but possibly-CPU-wasteful solution.
     return LOCKTYPE_SPINLOCK;
